﻿using System;
using System.Security.Cryptography;
using System.Text;

namespace User.Api.Helpers.WeixinPayV3
{
    public class Sha1Utility
    {
        public static string GetSha1(string encypStr)
        {
            var sha1 = new SHA1CryptoServiceProvider();

            //使用UTF8编码方式把字符串转化为字节数组．
            byte[] inputBye = Encoding.UTF8.GetBytes(encypStr);

            byte[] outputBye = sha1.ComputeHash(inputBye);

            string retStr = BitConverter.ToString(outputBye);
            retStr = retStr.Replace("-", "").ToLower();
            return retStr;
        }
    }
}